# def count_up_to(max):
#     count = 1
#     while count <= max:
#         yield count  # 暂停函数并返回值
#         count += 1


# counter = count_up_to(5)
# for num in counter:
#     print(num)


# Just as you can create a list comprehension, you can create generator
# comprehensions as well.

# 生成器
values = (2*x for x in [3, 4, 5, 6, 7])
for x in values:
    print(x)
